﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:sdk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:Images="clr-namespace:OI.Images" x:Class="OI.Views.CatalogView"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid Style="{StaticResource MainSubcontent}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <!--Category List-->
        <ContentControl x:Name="Categories"  Grid.Row="0" Grid.Column="0"  Margin="0,0,0,0" VerticalAlignment="Top"/>
        
        <!--Source List-->
        <ContentControl x:Name="Sources"  Grid.Row="1" Grid.Column="0" Margin="0,8,0,0" VerticalAlignment="Top"/>

        <!--Catalog Details-->
        <sdk:DataGrid   x:Name="Details" Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Margin="8,0,0,0" Height="500" VerticalAlignment="Top"
                        ItemsSource="{Binding Items}" SelectedItem="{Binding CatalogItem, Mode=TwoWay}" Style="{StaticResource OIDataGrids}">

            <sdk:DataGrid.Columns>
            	<sdk:DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*"/>
            	<sdk:DataGridTextColumn Header="Category" Binding="{Binding CategoryName}" MinWidth="100" Width="Auto"/>
            	<sdk:DataGridTextColumn Header="Source" Binding="{Binding SourceName}" MinWidth="100" Width="Auto"/>
            	<sdk:DataGridTextColumn Header="Published" Binding="{Binding FormattedPublishedDate}" MinWidth="100" MaxWidth="100"/>

                <sdk:DataGridTemplateColumn Header="Spatial" MinWidth="60" MaxWidth="60">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Images:IsSpatial Visibility="{Binding IsSpatial, Converter={StaticResource BoolToVisibility}}" RenderTransformOrigin="0.5, 0.5">
                                <Images:IsSpatial.RenderTransform>
                                    <ScaleTransform ScaleX="0.75" ScaleY="0.75" />
                                </Images:IsSpatial.RenderTransform>
                            </Images:IsSpatial>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>

            </sdk:DataGrid.Columns>
            
        </sdk:DataGrid>
    </Grid>
</UserControl>
